home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 6
/
The Arsenal Files 6 (Arsenal Computer).ISO
/
prg_basi
/
n_b-v200.zip
/
NBT1
/
DMO
/
SLIDER-2.DMO
< prev
next >
Wrap
Text File
|
1996-03-11
|
5KB
|
74 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME SLIDER-2.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NBT1.INC"
$INCLUDE "KEYCODES.INC"
COLOR 7, 0
CLS
? "┌───────────────────────────────────────────────────────────────────
? "│ TsliderV2 ( Row?, Col?, Rows?, IpS?, Items%, FoS% )
? "├──────────────────────────────────────────────────────────────────────
? "│ This is menu position indicator. Items% is the total number of items
? "│ in the menu, IpS? are the number of items visible, and FoS% is the
? "│ first item number to appear on the screen.
? "│ For our demo we're simulating a menu with 50 items. You move through
? "│ the list using UP and DOWN. Press ESC to end the demo.
? "└─────────────────────────────────────────────────────────────────────────
'┌───────────────────────
TBoxDRAW 10, 17, 13, 16, 1, 15 '│ a little menu box
TBoxDRAWv 10, 30, 13, 1, 1 '│ with a vert box right
TBoxColor 11, 31, 11, 1, 10 '│ a new attr in the v-box
TBoxColor 16, 18, 1, 12, 31 '│ and a selection bar
'│
Hot% = 1 '│ gotta start somewhere
DO '│ menu? loop
Row? = 11 '│ reprint menu items
FOR I% = ( Hot% - 5 ) TO ( Hot% + 5 ) '│ I like my selection bar
IF ( I% < 1 ) OR ( I% > 50 ) THEN '│ to stay in one place as
I$ = "░░░░░░░░░░" '│ it reduces eye strain
ELSE '│ for the user
I$ = USING$( "Item N° ##", I% ) '│
END IF '│
Tprint Row?, 19, I$, 0 '│ Att? = 0 so I don't
INCR Row?, 1 '│ have to compute it
NEXT '│
TsliderV2 11, 31, 11, 11, 50, Hot% '│ reprint the slider
SELECT CASE fGetKey% '│ act on key-press
CASE %HOME_key : Hot% = 1 '│ top of list
CASE %UP_key : Hot% = MAX( 1, Hot% - 1 ) '│ up one
CASE %PGUP_key : Hot% = MAX( 1, Hot% - 10 ) '│ up a page full - 1
CASE %END_key : Hot% = 50 '│ end of the list
CASE %DOWN_key : Hot% = MIN( 50, Hot% + 1 ) '│ down one
CASE %PGDN_key : Hot% = MIN( 50, Hot% + 10 ) '│ down a page full -1
CASE %ENTER_key : EXIT LOOP '│ all done!
CASE %ESC_key : EXIT LOOP '│ <ditto>
END SELECT '│
'│
LOOP '│ dah...
CLS '│ did we just write a
END '│ whole menu function?
' ──────────────────────────────────────────────────┤
FUNCTION fGetKey% LOCAL PUBLIC '│ seen this before?
'│
WHILE NOT INSTAT : WEND '│
FUNCTION = CVI( INKEY$ + CHR$(0) ) '│
'│
END FUNCTION '│